// Coefficients are obtained from http://www-users.cs.york.ac.uk/~fisher/mkfilter/trad.html
void setup(void){
  Serial.begin(115200);
}

void loop(void){
	float result;
        float result2;
	result = filter((float)analogRead(A0));
	result2 = filter((float)analogRead(A1));
	
        Serial.print(int(result));
	Serial.print(",");
	Serial.println(int(result2));
}
float filter(float x)
{
	static float v[4];

	v[0] = v[1];
	v[1] = v[2];
	v[2] = v[3];
	v[3] = v[4];
	v[4] = (1* x)
		+ ( -0.2179124252 * v[0])
		+ (  0.9212190545 * v[1])
		+ ( -2.1493435859 * v[2])
		+ ( 2.4448776776 * v[3]);
	return (v[0] + v[4]) - 2 * v[2];
}

